<script setup lang="ts">
import { ControlAction, FormControl } from "@ibiz-core"
import { ControlConfig } from "./control-config"
import { Subject } from "rxjs"

// props声明和默认值处理
interface Props {
  context: any
  viewParams?: any,
  showBusyIndicator?: boolean,
  viewSubject: Subject<any>,
  controlAction: ControlAction,
}
const props = withDefaults(defineProps<Props>(), {
  // 设定默认值,可选属性可以在这初始化
  showBusyIndicator: ControlConfig.showBusyIndicator
})

// 声明Emits
const emit = defineEmits<{
  (event: 'save'): void
}>()

// 安装功能模块，提供状态和能力方法
let { state, load, formDataChange } = new FormControl(ControlConfig).moduleInstall(props, emit)

function changeData(){
  state.data.namefield = '西游记'
}

</script>

<template>
  <div class="ibiz-control ibiz-edit-form">
    <h2>{{ state.data }}</h2>
    <h2>{{ state.data.namefield }}</h2>
    <button @click="()=> formDataChange('$DO','三国演义')">调用</button>
    <button @click="changeData">调用2</button>
    <el-button>ewrewr</el-button>
  </div>
</template>

<style scoped>
.ibiz-control-container {
  height: 100%;
  width: 100%;
}
</style>